/*
 * @Author: MrDotYan 2564217790@qq.com
 * @Date: 2024-09-10 22:38:44
 * @LastEditors: MrDotYan 2564217790@qq.com
 * @LastEditTime: 2024-09-10 22:58:58
 * @FilePath: /webServer/src/decorator/role.decorator.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// src/decorator/role.decorator.ts
import { savePropertyMetadata } from '@midwayjs/core';

export const ROLE_META_KEY = 'role:name';

export function Role(roleName: string | string[]): MethodDecorator {
  return (target, propertyKey) => {
    roleName = [].concat(roleName);
    // 只保存元数据
    savePropertyMetadata(ROLE_META_KEY, roleName, target, propertyKey);
  };
}
